Skip to content

docs(agents): propose explicit init and add commands#9135

Open
hund030 wants to merge 1 commit into
Azure:mainfrom
hund030:docs/agent-init-proposal
Open

docs(agents): propose explicit init and add commands#9135
hund030 wants to merge 1 commit into
Azure:mainfrom
hund030:docs/agent-init-proposal

Conversation

@hund030

@hund030 hund030 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Design proposal for #8383. azd ai agent init currently creates or modifies projects based on directory context, making behavior difficult to predict and debug.

Changes

  • agent init/add contract: separate new-project initialization from adding agents to existing projects.
  • --infra compatibility: retain post-init and standalone IaC generation with explicit decision rules.
  • review decisions: document scope, migration behavior, command matrix, and open product questions.

Copilot AI review requested due to automatic review settings July 14, 2026 11:25
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
20 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported identify a customer issue label Jul 14, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution @hund030! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Proposes separating agent project creation from adding agents to existing projects.

Changes:

  • Defines agent init and agent add contracts.
  • Documents source selection and --infra behavior.
  • Records scope and compatibility decisions.

### Sources

```text
--template
| `init` | No | Yes | Yes | Initialize, then generate IaC. |
| `init` | No | No | No | Interactive: choose source; non-interactive: fail. |
| `init` | No | No | Yes | Interactive: choose source, initialize, generate IaC; non-interactive: fail. |
| `init` | Yes | No | Yes | Generate IaC only. |
add + source -> validate existing project -> merge/register agent
```

Both `init` and `add` share source resolution and agent-registration logic. Registration merges the complete service graph instead of replacing existing Foundry services one at a time. The detailed engineering design defines concurrency, retry, and compatibility mechanics.

3. **Should `init` ever automatically call `add` when it finds a project?** Proposed: No. Fail before mutation and print the exact replacement command.

4. **Should existing positional and `--src` forms remain temporarily?** Proposed: Yes, with deprecation warnings and deterministic translation to the new source options.

@jongio jongio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One consistency gap I didn't see raised yet, noted inline on the decision table.

| `init` | No | Yes | Yes | Initialize, then generate IaC. |
| `init` | No | No | No | Interactive: choose source; non-interactive: fail. |
| `init` | No | No | Yes | Interactive: choose source, initialize, generate IaC; non-interactive: fail. |
| `init` | Yes | No | Yes | Generate IaC only. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavioral rules scope IaC-only to an existing compatible project (lines 110-111), and Non-scope rejects unsafe shapes like Aspire projects or multiple Foundry project services. This table only keys on Project found, so init --infra against an incompatible existing project resolves to Generate IaC only here instead of failing. Consider carrying the compatibility gate into the table (or a note) so an unsupported project shape maps to a fail-with-guidance result rather than IaC generation.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the no-recent-activity identity issues with no activity label Jul 23, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Hi @@hund030. Thank you for your interest in helping to improve the Azure Developer CLI experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days.

@jongio jongio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One structural note on the two decision surfaces, inline.

|---|---:|---:|---:|---|
| `init` | No | Yes | No | Initialize project and agent. |
| `init` | No | Yes | Yes | Initialize, then generate IaC. |
| `init` | No | No | No | Interactive: choose source; non-interactive: fail. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Behavioral rules table above and this Decision table encode the same init/add contract with different columns, and they've already drifted. Behavioral rules restrict standalone --infra to an existing compatible project (lines 116-117), but this table's init | Yes | No | Yes row drops the compatibility qualifier and just says IaC only. The missing bare init in an existing project row that others flagged is the same failure mode. Two hand-maintained tables for one contract will keep diverging as the design evolves. Consider making one the single source of truth and deriving or dropping the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

customer-reported identify a customer issue no-recent-activity identity issues with no activity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants